﻿using System;
using System.Data;
using System.Data.OracleClient;
using System.Data.Common;

namespace ZhhbSoft.Data
{

    /// <summary>
    ///OracleDbProvider 的摘要说明
    /// </summary>
    public class OracleDbProvider : DbProvider
    {
        public OracleDbProvider()
        {
        }
        public OracleDbProvider(string strConnectionString)
            : base(strConnectionString)
        {
            _supportTRANSACTION = true;
        }

        protected override IDbConnection CreateConnection()
        {
            try
            {
                var conn = new OracleConnection();
                return conn;
            }
            catch
            {
                throw new Exception("数据库连接失败！");
            }

        }

        protected override DbDataAdapter CreateDataAdapter(IDbCommand cmd)
        {
            return new OracleDataAdapter((OracleCommand)cmd);
        }

        protected override IDbDataParameter CreateDataParameter()
        {
            var sqlParameter = new OracleParameter();
            return sqlParameter;
        }


        public override IDbCommand CreateCommand()
        {
            return new OracleCommand();
        }
    }
}